package com.qf.lja.servlet;

import com.qf.lja.dao.TypeDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@WebServlet(urlPatterns = "/typeList.do")
public class TypeListServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");

        System.out.println("TypeListServlet");
        TypeDao typeDao = new TypeDao();
        req.setAttribute("typeList", typeDao.getTypeList());
        //打印list
        System.out.println(typeDao.getTypeList());
        if (typeDao.getTypeList() != null) {

            req.getRequestDispatcher("index.jsp").forward(req, resp);
        }
    }
}
